package cn.edu.zjut.mina.po;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Table(name="t_every")
@Entity
public class Every {
	private Integer autoid;
	private Total total;
	private List<User> users;
	@GeneratedValue
	@Id
	public Integer getAutoid() {
		return autoid;
	}
	public void setAutoid(Integer autoid) {
		this.autoid = autoid;
	}
	
	@ManyToOne(cascade = CascadeType.PERSIST, optional=true,fetch = FetchType.EAGER)
	@JoinColumn(name="total_id", referencedColumnName="autoid")
	public Total getTotal() {
		return total;
	}
	public void setTotal(Total total) {
		this.total = total;
	}
	
	@OneToMany(mappedBy = "every", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public List<User> getUsers() {
		return users;
	}
	public void setUsers(List<User> users) {
		this.users = users;
	}
	
	
	
}
